home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 645 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.6 KB

  1. Path: locutus.rchland.ibm.com!usenet
  2. From: pstaite@vnet.ibm.com
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: about for loop
  5. Date: 5 Jan 1996 15:01:28 GMT
  6. Organization: IBM OS/2 Device Driver Development  Rochester, MN
  7. Message-ID: <4cjeg8$16vn@locutus.rchland.ibm.com>
  8. References: <4civik$cmg@peter.pu.edu.tw>
  9. Reply-To: pstaite@vnet.ibm.com
  10. NNTP-Posting-Host: warpone.rchland.ibm.com
  11. X-Newsreader: IBM NewsReader/2 v1.2
  12.  
  13. In <4civik$cmg@peter.pu.edu.tw>, s8311116@csim49.pu.edu.tw () writes:
  14. >  if i write this for loop"for(i=0 ; i<=10 ; i++ )
  15. >                           cout<< i ;
  16. >  the result should be " 12345678910 " or " 0123456789 " ?
  17. >  and what is "double linked list " ??
  18. >  thanks!
  19.  
  20. Actually, I would expect to see "012345678910" :-)
  21.  
  22. A doublely linked list is a data structure where each node or link in 
  23. the list maintains some data and a reference or pointer to the nodes
  24. adjacent to it. (ie. the node that preceeds it and the node that follows
  25. it)
  26.  
  27. Contrast this to a singlely linked list where each node only maintains a
  28. single reference or pointer to one adjacent node in addition to the 
  29. data.
  30.  
  31. The primary difference is the size of each node (one or two pointers in
  32. addition to the data) and in the ease with which you can traverse the
  33. list.  Doublely linked lists are easy to traverse in either direction. 
  34. Practically speaking, you can really only traverse a SL list in one
  35. direction. (although you can make it logically look like you're 
  36. "backing up" an SL list this becomes an order n-squared operation)
  37.  
  38.  
  39. Phil Staite, team OS/2
  40. internet: pstaite@vnet.ibm.com  internal: pstaite@rchland
  41.  
  42.